import service from "@/api/request.js";

/* 新增隐患描述接口
   postdata: 新增页面提交的数据
   return：Promise格式数据
*/
export const add_hazard = async (postdata) => {
    return await service({
            method: 'POST',
            url: '/hazardAdminAPI/add_hazard',
            data: postdata
        })
        .then(res => Promise.resolve(res))
        .catch(error => Promise.reject(error));
}

/* 隐患描述查询接口
   postdata: 用户管理页面提交的查询数据
   return：Promise格式数据
*/
export const get_hazard = async (postdata) => {
    return await service({
            method: 'POST',
            url: '/hazardAdminAPI/get_hazard',
            data: postdata
        })
        .then(res => Promise.resolve(res))
        .catch(error => Promise.reject(error));
}

/* 隐患描述信息接口
   postdata:  隐患描述信息页面提交的删除数据
   return：Promise格式数据
*/
export const delete_hazard = async (postdata) => {
    return await service({
            method: 'POST',
            url: '/hazardAdminAPI/delete_hazard',
            data: postdata
        })
        .then(res => Promise.resolve(res))
        .catch(error => Promise.reject(error));
}

/* 隐患描述信息接口
   postdata: 隐患描述信息页面提交的更新数据
   return：Promise格式数据
*/
export const update_hazard = async (postdata) => {
    return await service({
            method: 'POST',
            url: '/hazardAdminAPI/update_hazard',
            data: postdata
        })
        .then(res => Promise.resolve(res))
        .catch(error => Promise.reject(error));
}